﻿<Frame x:Class="StockManagement.Views.OutwardMaterial"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
       xmlns:sys="clr-namespace:System;assembly=mscorlib"
       xmlns:helper="clr-namespace:StockManagement.Helper"
       xmlns:views="clr-namespace:StockManagement.Views" NavigationUIVisibility="Hidden">
    <Frame.Content>
        <Grid x:Name="mainGrid">

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <!--<ColumnDefinition Width="0.3*"></ColumnDefinition>
                            <ColumnDefinition Width="0.7*"></ColumnDefinition>-->
            </Grid.ColumnDefinitions>

            <TextBlock Margin="3" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" Text="Material Code" Height="23" Padding="3"></TextBlock>
            <ComboBox x:Name="cmbMaterialCode" Grid.Column="1" VerticalAlignment="Center" MinWidth="150" Margin="3" IsEditable="False"
                              ItemsSource="{Binding Path=OutwardMaterialCollection}"  DisplayMemberPath="MaterialCode" SelectedValuePath="MaterialID"
                              SelectedItem="{Binding Path=SelectedMaterial, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" IsSynchronizedWithCurrentItem="True"
                      SelectionChanged="cmbMaterialCode_SelectionChanged"
                      HorizontalAlignment="Stretch" VerticalContentAlignment="Center" Padding="3" Height="26" Background="{StaticResource GridLineColorBrush}">
            </ComboBox>

            <Label Content="Material name :" Grid.Row="1" Margin="2"  Padding="3" Height="23"></Label>
            <Border  Grid.Row="1" Grid.Column="1" Margin="2" BorderThickness="1" BorderBrush="{StaticResource DefaultControlForegroundBrush}">
                <TextBlock  Padding="3" Text="{Binding Path=SelectedMaterial.MaterialName}" HorizontalAlignment="Stretch" VerticalAlignment="Center"></TextBlock>
            </Border>


            <Label Content="Material Type :" Grid.Row="2" Margin="2"  Padding="3" Height="23"></Label>
            <Border  Grid.Row="2" Grid.Column="1" Margin="2" BorderThickness="1" BorderBrush="{StaticResource DefaultControlForegroundBrush}">
                <TextBlock  Padding="3" Text="{Binding Path=SelectedMaterial.MaterialType}" HorizontalAlignment="Stretch" VerticalAlignment="Center"></TextBlock>
            </Border>

            <Label Content="Purchaser :" Grid.Row="3" Margin="2"  Padding="3" Height="23"></Label>
            <TextBox Grid.Row="3" Grid.Column="1" Padding="3" Text="{Binding Path=Purchaser,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Stretch" VerticalAlignment="Center"></TextBox>

            <TextBlock Grid.Row="4" Margin="3" Text="Vendor" HorizontalAlignment="Left" VerticalAlignment="Center" Height="23" Padding="3">
            </TextBlock>            
            <Border  Grid.Row="4" Grid.Column="1" Margin="2" BorderThickness="1" BorderBrush="{StaticResource DefaultControlForegroundBrush}">
                <TextBlock  Padding="3" Text="{Binding Path=SelectedMaterial.Vendor}" HorizontalAlignment="Stretch" VerticalAlignment="Center"></TextBlock>
            </Border>

            <TextBlock Margin="3" Grid.Row="5" Text="Rate" HorizontalAlignment="Left" VerticalAlignment="Center" Height="23" Padding="3"></TextBlock>            
            <Border  Grid.Row="5" Grid.Column="1" Margin="2" BorderThickness="1" BorderBrush="{StaticResource DefaultControlForegroundBrush}">
                <TextBlock  Padding="3" Text="{Binding Path=SelectedMaterial.MaterialRate}" HorizontalAlignment="Stretch" VerticalAlignment="Center"></TextBlock>
            </Border>

            <TextBlock Text="Quantity" Grid.Row="6" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"></TextBlock>            
            <Border  Grid.Row="6" Grid.Column="1" Margin="2" BorderThickness="1" BorderBrush="{StaticResource DefaultControlForegroundBrush}">
                <TextBlock  Padding="3" Text="{Binding Path=SelectedMaterial.Quantity}" HorizontalAlignment="Stretch" VerticalAlignment="Center"></TextBlock>
            </Border>

            <TextBlock Text="VAT" Grid.Row="7" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"></TextBlock>
            <Border  Grid.Row="7" Grid.Column="1" Margin="2" BorderThickness="1" BorderBrush="{StaticResource DefaultControlForegroundBrush}">
                <TextBlock  Padding="3" Text="{Binding Path=SelectedMaterial.MaterialVAT}" HorizontalAlignment="Stretch" VerticalAlignment="Center"></TextBlock>
            </Border>

            <!--<Label Content="Purchase Date :" Grid.Row="4" Margin="2"  Padding="3" Height="23"></Label>
            <Border  Grid.Row="4" Grid.Column="1" Margin="2" BorderThickness="1" BorderBrush="{StaticResource DefaultControlForegroundBrush}">
                <TextBlock  Padding="3" Text="{Binding Path=Date, StringFormat={}{0:dd-MMM-yyyy}}" Height="25" HorizontalAlignment="Stretch" VerticalAlignment="Center"></TextBlock>
            </Border>-->

            <StackPanel Grid.Row="8" Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Margin="5" MinWidth="60" Command="{Binding Path=UpdateCommand}" Padding="3">Update as Delivered</Button>
                <Button Margin="5" MinWidth="60" Command="{Binding Path=DiscardCommand}" Padding="3">Discard</Button>
            </StackPanel>

        </Grid>
    </Frame.Content>
</Frame>